package com.essence.common.model.parser;

import com.essence.common.model.Packet;
import io.netty.buffer.ByteBuf;

/**
 * @brief 遥调：标准渡化值
 */
public class CSeNbParser extends ByteBufParser {
    @Override
    void parse(Packet packet, ByteBuf buf) {
        if(packet.getVsq().getNum() != 1) {
            throw new DataBitsVerifyException(packet.getTieIdentification().getDescription(), "Vqs.num()", "必须等于1");
        }
        int infoAdr = buf.readUnsignedMediumLE();
        int nva = buf.readShortLE();
        short qos = buf.readUnsignedByte();
        Packet.AnalogSignals analogSignals = new Packet.AnalogSignals(infoAdr, nva, null, qos);
        packet.addAnalogSignals(analogSignals);
    }

    @Override
    int infoObjectLength() {
        return 6;
    }
}
